﻿// <copyright file="Platform.cs" company="Microsoft Corporation">
// Copyright (c) 2010 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2010-11-16</date>
// <summary>Platform class definition</summary>

namespace NYTimes.Core
{
    using System.Windows.Browser;

    /// <summary>
    /// Silverlight-Specific Platform Methods
    /// </summary>
    internal class Platform
    {
        /// <summary>
        /// Prevents a default instance of the Platform class from being created.
        /// </summary>
        private Platform()
        {
        }

        /// <summary>
        /// Converts a string that has been HTML-encoded (for HTTP transmission) into a decoded string.
        /// </summary>
        /// <param name="html">An HTML-encoded string to decode.</param>
        /// <returns>A decoded string</returns>
        public static string HtmlDecode(string html)
        {
            return HttpUtility.HtmlDecode(html);
        }

        /// <summary>
        /// Converts a string that has been encoded for transmission in a URL into a decoded string.
        /// </summary>
        /// <param name="url">A URL-encoded string to decode.</param>
        /// <returns>A decoded string</returns>
        public static string UrlDecode(string url)
        {
            return HttpUtility.UrlDecode(url);
        }

        /// <summary>
        /// Converts a text string into a URL-encoded string.
        /// </summary>
        /// <param name="url">the text to URL-encode</param>
        /// <returns>A URL-encoded string.</returns>
        public static string UrlEncode(string url)
        {
            return HttpUtility.UrlEncode(url);
        }
    }
}
